using System;
using System.Collections.Generic;
using FreeSql.DataAnnotations;

namespace Colorful.Furniture.PermissionManagement
{

    /// <summary>
    /// 资源
    /// </summary>
    [Table(Name = "sys_resource")]
    public partial class SysResource
    {
        /// <summary>
        /// 编码
        /// </summary>
        [Column(Name = "id", IsPrimary = true, IsIdentity = true)]
        public Guid Id { get; set; }

        /// <summary>
        /// 父级编码
        /// </summary>
        [Column(Name = "parent_id")]
        public Guid? ParentId { get; set; }

        /// <summary>
        /// 资源图标/字体图标
        /// </summary>
        [Column(Name = "img_url", StringLength = 50)]
        public string ImgUrl { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        [Column(Name = "is_deleted")]
        public bool IsDeleted { get; set; }

        /// <summary>
        ///  资源类型
        /// </summary>
        [Column(Name = "resource_type")]
        public int ResourceType { get; set; }

        /// <summary>
        /// 是否隐藏
        /// </summary>
        [Column(Name = "is_hide")]
        public bool? IsHide { get; set; }

        /// <summary>
        /// 是否系统
        /// </summary>
        [Column(Name = "is_sys")]
        public bool IsSys { get; set; }

        /// <summary>
        /// 菜单名字对应前端路由名字
        /// </summary>
        [Column(Name = "name", StringLength = 100)]
        public string Name { get; set; }

        /// <summary>
        ///  菜单标题
        /// </summary>
        [Column(Name = "title", StringLength = 50)]
        public string Title { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [Column(Name = "remark", StringLength = 200)]
        public string Remark { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        [Column(Name = "sort")]
        public int? Sort { get; set; }

        /// <summary>
        ///  资源代码自增长
        /// </summary>
        [Column(Name = "resource_code", IsIdentity = true)]
        public int ReourceCode { get; set; }

        /// <summary>
        /// 路径
        /// </summary>
        [Column(Name = "url", StringLength = 100)]
        public string Url { get; set; }


        #region 外键 => 导航属性，ManyToOne/OneToOne


        public virtual SysResource Parent { get; set; }

        #endregion

        #region 外键 => 导航属性，OneToMany


        public virtual List<SysResource> Children { get; set; }

        [Navigate(nameof(SysPermission.ResourceId))]
        public virtual List<SysPermission> SysPermissions { get; set; }

        #endregion

        #region 外键 => 导航属性，ManyToMany

        #endregion
    }

}
